package com.ywk.pattern._8_methodfactory;

public class Operation {
    private Integer numberA = 0;
    private Integer numberB = 0;

    public Integer getNumberA() {
        return numberA;
    }

    public void setNumberA(Integer numberA) {
        this.numberA = numberA;
    }

    public Integer getNumberB() {
        return numberB;
    }

    public void setNumberB(Integer numberB) {
        this.numberB = numberB;
    }
    public double getResult(){
        System.out.println("操作");
        return 0;
    }
}
class  OperationAdd extends  Operation{
    @Override
    public double getResult() {

        return getNumberA()+getNumberB();
    }
}
class  OperationSubtract extends  Operation{
    @Override
    public double getResult() {

        return getNumberA()-getNumberB();
    }
}
class  OperationMultiply extends  Operation{
    @Override
    public double getResult() {

        return getNumberA()*getNumberB();
    }
}
class  OperationDivide extends  Operation{
    @Override
    public double getResult() {

        return getNumberA()/getNumberB();
    }
}